import 'package:flutter/material.dart';

// main() {
//   runApp(const Center(
//     child: Text('我的第一个flutter应用',
//         textDirection: TextDirection.ltr, style: TextStyle(fontSize: 30, color: Colors.green)),
//   ));
// }

//====================================

// main() {
//   runApp(const Center(
//     child: Text(
//       '我是第一个flutter应用',
//       textDirection: TextDirection.ltr,
//       style: TextStyle(fontSize: 20, color: Colors.blue),
//     ),
//   ));
// }

//====================================

// main() {
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return const Center(
//       child: Text(
//         'this is first fltter app',
//         textDirection: TextDirection.ltr,
//         style:
//             TextStyle(fontSize: 20, color: Color.fromARGB(255, 255, 255, 255)),
//       ),
//     );
//   }
// }

//====================================
//
// main() {
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       home: Scaffold(
//         appBar: AppBar(
//             title: const Text(
//           '我是标题',
//           textDirection: TextDirection.ltr,
//           style: TextStyle(color: Colors.blue),
//         )),
//         body: HomeContent(),
//       ),
//       theme: ThemeData(primarySwatch: Colors.grey),
//     );
//   }
// }
//
// class HomeContent extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return const Center(
//       child: Text(
//         'this is first app',
//         textDirection: TextDirection.ltr,
//         style: TextStyle(color: Colors.black),
//       ),
//     );
//   }
// }

//======================================================

// main() {
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       theme: ThemeData(primarySwatch: Colors.blue),
//       home: Scaffold(
//         appBar: AppBar(
//           title: Text(
//             '我是AppBar',
//             textDirection: TextDirection.ltr,
//           ),
//         ),
//         body: HomeContent(),
//       ),
//     );
//   }
// }
//
// class HomeContent extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return Center(
//       child: Text(
//         '我是第一个app',
//         textDirection: TextDirection.ltr,
//         style: TextStyle(fontSize: 20, color: Colors.red),
//       ),
//     );
//   }
// }

//==========================字体属性============================
// main() {
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       theme: ThemeData(primaryColor: Colors.red),
//       home: Scaffold(
//         appBar: AppBar(title: Text('this is bar **')),
//         body: HomeContent(),
//       ),
//     );
//   }
// }
//
// class HomeContent extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return Center(
//         child: Container(
//       child: Text(
//         '我是显示的内容哦我是显示的内容哦我是显示的内容哦我是显示的内容哦我是显示的内容哦',
//         textDirection: TextDirection.ltr,
//         textAlign: TextAlign.center,
//         //居中
//         overflow: TextOverflow.ellipsis,
//         maxLines: 2,
//         style: TextStyle(
//             fontSize: 20,
//             color: Colors.red,
//             fontWeight: FontWeight.w800,
//             //加宽
//             fontStyle: FontStyle.italic,
//             //斜体
//             letterSpacing: 5 //行间距
//             ),
//       ),
//       // transform: Matrix4.skew(0, 10),
//       // transform: Matrix4.translationValues(10, 10, 10),
//       // transform: Matrix4.rotationZ(0.1),//
//       transform: Matrix4.rotationZ(-0.1),//
//           // transform: Matrix4.diagonal3Values(1.2, 1,1),
//       width: 300,
//       height: 300,
//       margin: EdgeInsets.fromLTRB(10, 5, 30, 0),
//       // padding: EdgeInsets.all(30),
//       padding: EdgeInsets.fromLTRB(20, 5, 0, 0),
//       decoration: BoxDecoration(
//           color: Colors.yellow,
//           borderRadius: BorderRadius.all(Radius.circular(60)),
//           border: Border.all(width: 8, color: Colors.red)),
//       // alignment: Alignment.center,//居中显示
//       // alignment: Alignment.bottomRight,//底部居右
//     ));
//   }
// }

//==========================加载网络图片============================
// main() {
//   runApp(MyApp());
// }
//
// ////加载网络图片
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//         theme: ThemeData(primaryColor: Colors.red),
//         home: Scaffold(
//             appBar: AppBar(
//               title: Text('this is an bar'),
//             ),
//             body: Center(
//                 child: Container(
//               child: Image.network(
//                   "https://img0.baidu.com/it/u=3119542616,1165410720&fm=26&fmt=auto",
//                   fit: BoxFit.cover),
//               width: 300,
//               height: 300,
//               color: Colors.red,
//             ))));
//   }
// }

//==========================加载本地图片============================
//
// main(){
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       theme: ThemeData(primaryColor: Colors.red),
//       home: Scaffold(
//         appBar: AppBar(title: Text('title'),),
//         body: Center(
//           child: SizedBox(
//             child: Image.asset("images/better.png",
//             width: 100,height: 100, fit: BoxFit.cover,),
//           ),
//         ),
//       ),
//     );
//   }
// }

//==========================加载圆角图片1============================
//
// main() {
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       theme: ThemeData(primaryColor: Colors.green),
//       home: Scaffold(
//         appBar: AppBar(title: Text('barbar')),
//         body: Center(
//           child: Container(
//             child: ClipOval(
//               child: Image.network(
//                 "https://img0.baidu.com/it/u=3119542616,1165410720&fm=26&fmt=auto",
//                 width: 300,
//                 fit: BoxFit.cover,
//                 height: 300,
//               ),
//             ),
//           ),
//         ),
//       ),
//     );
//   }
// }

//==========================加载网络圆角图片2============================
// main() {
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       theme: ThemeData(primaryColor: Colors.green),
//       home: Scaffold(
//         appBar: AppBar(
//           title: Text('加载圆角图片2'),
//         ),
//         body: Center(
//           child: Container(
//             width: 100,
//             height: 100,
//             decoration: BoxDecoration(
//                 borderRadius: BorderRadius.circular(50),
//                 image: DecorationImage(
//                     image: NetworkImage(
//                         'https://img0.baidu.com/it/u=3119542616,1165410720&fm=26&fmt=auto'),
//                     fit: BoxFit.cover)),
//           ),
//         ),
//       ),
//     );
//   }
// }

//==========================ListView============================
// main() {
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       theme: ThemeData(primaryColor: Colors.green),
//       home: Scaffold(
//         appBar: AppBar(
//           title: Text('title'),
//         ),
//         body: HomeContent(),
//       ),
//     );
//   }
// }
//
//
// class HomeContent extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return ListView(
//       children: [
//         ListTile(
//           leading: Icon(
//             Icons.settings,
//             size: 50,
//           ),
//           title: Text('标题'),
//           subtitle: Text('小标题'),
//         ),
//         ListTile(
//           leading: Icon(Icons.home),
//           title: Text(
//             '标题',
//             style: TextStyle(fontSize: 30),
//           ),
//           subtitle: Text('小标题'),
//         ),
//         ListTile(
//           leading: Icon(Icons.email),
//           title: Text('标题'),
//           subtitle: Text('小标题'),
//           trailing: Icon(Icons.ac_unit_sharp),
//         ),
//         ListTile(
//           leading: Image.network(
//               'https://img0.baidu.com/it/u=3119542616,1165410720&fm=26&fmt=auto'),
//           title: Text('标题'),
//           subtitle: Text('小标题'),
//           trailing: Image.network(
//               'https://img0.baidu.com/it/u=3119542616,1165410720&fm=26&fmt=auto'),
//         ),
//         ListTile(
//           title: Text('标题'),
//           subtitle: Text('小标题'),
//         ),
//         ListTile(
//           title: Text('标题'),
//           subtitle: Text('小标题'),
//         ),
//         Image.network(
//             "https://img0.baidu.com/it/u=3119542616,1165410720&fm=26&fmt=auto"),
//       ],
//     );
//   }
// }

//========================== ListView 横版 ============================

// main() {
//   runApp(MyApp());
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     return MaterialApp(
//       theme: ThemeData(primaryColor: Colors.green),
//       home: Scaffold(
//           appBar: AppBar(
//             title: Text('bar'),
//           ),
//           body: Container(
//             height: 100,
//             child: ListView(
//               scrollDirection: Axis.horizontal,
//               children: [
//                 Container(
//                   width: 100,
//                   color: Colors.green,
//                 ),
//                 Container(
//                   width: 100,
//                   color: Colors.red,
//                 ),
//                 Container(
//                   width: 100,
//                   color: Colors.white,
//                 ),
//                 Container(
//                   width: 100,
//                   color: Colors.cyanAccent,
//                 ),
//                 Container(
//                   width: 100,
//                   color: Colors.white60,
//                 ),
//                 Container(
//                   width: 100,
//                   color: Colors.indigo,
//                 )
//               ],
//             ),
//           )),
//     );
//   }
// }

main() {
  // runApp(MyApp());
  // runApp(MyView());
  runApp(ListDynApp());
}

class ListDynApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primaryColor: Colors.indigo),
      home: Scaffold(
        appBar: AppBar(
          title: Text('appbar'),
        ),
        body: Content(),
      ),
    );
  }
}

class Content extends StatelessWidget {
  List list = [];

  List<Widget> _getDatas() {
    return [

      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-002.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-003.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-004.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-005.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-006.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-007.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-008.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-012.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-010.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
      Container(
        width: 10,
      ),
      Image.network(
        'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-011.jpg',
        fit: BoxFit.cover,
        width: 150,
      ),
    ];
  }

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: _getDatas(),
      scrollDirection: Axis.horizontal,
    );
  }
}

class MyView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primaryColor: Colors.indigo),
      home: Scaffold(
        appBar: AppBar(
          title: Text('title'),
        ),
        body: HomeContent(),
      ),
    );
  }
}

class HomeContent extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: ListView(
        children: [
          Image.network(
              "https://img-pre.ivsky.com/img/tupian/pre/202106/29/yingsuhua.jpg"),
          Container(
            height: 200,
            width: 200,
            color: Colors.red,
          ),
          Text(
            'this is content',
            style: TextStyle(fontSize: 30, color: Colors.black),
          )
        ],
      ),
    );
  }
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primaryColor: Colors.indigo),
      home: Scaffold(
        appBar: AppBar(
          title: Text('appbar'),
        ),
        body: Container(
          height: 150,
          child: ListView(
            padding: EdgeInsets.all(10),
            scrollDirection: Axis.horizontal,
            children: [
              Image.network('https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-002.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-003.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-004.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-005.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-006.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-007.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-008.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-012.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-010.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
              Container(
                width: 10,
              ),
              Image.network(
                'https://img-pre.ivsky.com/img/tupian/pre/202106/29/lanmei-011.jpg',
                fit: BoxFit.cover,
                width: 150,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
